# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Tuan M. Hoang <tmhoang@flatglobe.org>
pkgname=x11vnc
pkgver=0.9.16
pkgrel=4
pkgdesc="VNC server for real X displays"
url="https://github.com/LibVNC/x11vnc"
arch="all"
license="GPL-2.0-or-later"
makedepends="openssl1.1-compat-dev libjpeg-turbo-dev avahi-dev libvncserver-dev
	automake autoconf"
subpackages="$pkgname-doc"
source="x11vnc-$pkgver.tar.gz::https://github.com/LibVNC/x11vnc/archive/$pkgver.tar.gz
	0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch
	CVE-2020-29074.patch
	gcc-10.patch
	"

# secfixes:
#   0.9.16-r2:
#     - CVE-2020-29074

prepare() {
	default_prepare
	autoreconf -v --install
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var
	make
}

package() {
	make -j1 DESTDIR="$pkgdir" install
}

check() {
	make check
}

sha512sums="69f65ee312f8dede6051b401304987502a213c6c28c7f41e855734f11de1fae14d5d493dc9c28b2e4b7c0be55f8dbd3b35dd2610aae910183772c3e626736fec  x11vnc-0.9.16.tar.gz
7752f125b083ec2d8c778dcc460853d29cf62cd354dc454aa132d3eb1671ad4592923cca5360884cf86f25d989fa04db04120d5d70782d65164821d463107e2e  0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch
d2ee26414451a7e92b3c687c51abe74637cff247a264ebd46080dd570e05db3231425441e56b7ed4a39aa01b6f6ab600cf1b4c9a0216e8030983b43e1f609bda  CVE-2020-29074.patch
594c364c21ae7274e521dd44ee265f0330be788e7ec6995fc0fce09f3cfa9e1f3340931490df77a42bb7f6d8a6d67eb918174599a901b26b30df59cf20ab6af5  gcc-10.patch"
